package com.tiancheng.trade.payment.enums;

import com.tiancheng.trade.commom.core.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author: likailun
 * @Description: 优惠券清分业务类型
 * @Date: create in 2022/1/4 6:09 下午
 */
@Getter
@AllArgsConstructor
public enum CouponSettleBusinessTypeEnum implements BaseEnum<Integer> {
    GET_MANAGEMENT_FEE(0, "平台合并收取管理费"),
    TRANSFER_OUT(1, "转款补贴-转出"),
    TRANSFER_IN(2, "转款补贴-转入"),
    ;
    private Integer code;
    private String desc;

    public static CouponSettleBusinessTypeEnum getOne(int code) {
        Optional<CouponSettleBusinessTypeEnum> found = Arrays.stream(CouponSettleBusinessTypeEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        return found.orElse(null);
    }
}
